import { axios } from '@/utils/request'

const api = {
  user: '/user',
  role: '/role',
  service: '/service',
  permission: '/permission',
  permissionNoPager: '/permission/no-pager',
  orgTree: '/org/tree',
  Class: {
    list:'/class/list'
  },
  Grade: {
    list:'/grade/list'
  },
  Room: {
    list:'/room/list'
  },
  Student: {
    list:'/student/list'
  },
  Teacher: {
    list:'/teacher/list'
  },
  Famliy: {
    list:'/famliy/list'
  },
  Subject: {
    list:'/subject/list'
  },
  Schedule: {
    list:'/schedule/list'
  },
  Experiment: {
    Exam:{
      list:'/experiment/exam/list',
      Video:{
        list:'/experiment/exam/video/list'
      }
    }
  }
}

export default api

export function getUserList(parameter) {
  return axios({
    url: api.user,
    method: 'get',
    params: parameter
  })
}



export function getServiceList(parameter) {
  return axios({
    url: api.service,
    method: 'get',
    params: parameter
  })
}
// 联动接口
export function getBuildingList(parameter) {
  return axios({
    url: '/UtilSelect/findClsBud',
    method: 'get',
    params: parameter
  })
}
export function getClassYearList(parameter) {
  return axios({
    url: '/UtilSelect/findClsYear',
    method: 'get',
    params: parameter
  })
}
export function findYearList(parameter) {
  return axios({
    url: '/UtilSelect/findYear',
    method: 'get',
    params: parameter
  })
}

// 班级接口
export function getClassList(parameter) {
  return axios({
    url: '/cls/list',
    method: 'get',
    params: parameter
  })
}

export function addClass(parameter) {
  return axios({
    url: '/cls/add',
    method: 'post',
    data: parameter
  })
}

export function getClass(parameter) {
  return axios({
    url: '/cls/info',
    method: 'get',
    params: parameter
  })
}

export function editClass(parameter) {
  return axios({
    url: '/cls/update',
    method: 'post',
    data: parameter
  })
}

export function delClass(parameter) {
  return axios({
    url: '/cls/delete',
    method: 'get',
    params: parameter
  })
}


// 教师设置接口
export function setClassTeacher(parameter) {
  return axios({
    url: '/cls/teacherOfCls',
    method: 'post',
    data: parameter
  })
}
export function getTeacherOfClass(parameter) {
  return axios({
    url: '/cls/getTeacherOfCls',
    method: 'get',
    params: parameter
  })
}
//  学生设置接口
export function getStudentOfClass(parameter) {
  return axios({
    url: '/cls/getStudentOfCls',
    method: 'get',
    params: parameter
  })
}
export function setClassStudent(parameter) {
  return axios({
    url: '/cls/studentOfCls',
    method: 'post',
    data: parameter
  })
}
// 教室接口
export function getRoomList(parameter) {
  return axios({
    url: '/classRoom/list',
    method: 'get',
    params: parameter
  })
}

export function addRoom(parameter) {
  return axios({
    url: '/classRoom/add',
    method: 'post',
    data: parameter
  })
}

export function getRoom(parameter) {
  return axios({
    url: '/classRoom/info',
    method: 'get',
    params: parameter
  })
}

export function editRoom(parameter) {
  return axios({
    url: '/classRoom/update',
    method: 'post',
    data: parameter
  })
}

export function delRoom(parameter) {
  return axios({
    url: '/classRoom/delete',
    method: 'get',
    params: parameter
  })
}
// 家长接口
export function getFamliyList(parameter) {
  return axios({
    url: '/family/list',
    method: 'get',
    params: parameter
  })
}

export function addFamliy(parameter) {
  return axios({
    url: '/family/add',
    method: 'post',
    data: parameter
  })
}

export function getFamliy(parameter) {
  return axios({
    url: '/family/info',
    method: 'get',
    params: parameter
  })
}

export function editFamliy(parameter) {
  return axios({
    url: '/family/update',
    method: 'post',
    data: parameter
  })
}

export function delFamliy(parameter) {
  return axios({
    url: '/family/delete',
    method: 'get',
    params: parameter
  })
}
export function getChildrenSelect(keyword) {
  return axios({
    url: '/student/easyList',
    method: 'get',
    params: {
      keyword:keyword
    }
  })
}
// 学生接口
export function getStudentList(parameter) {
  return axios({
    url: '/student/list',
    method: 'get',
    params: parameter
  })
}

export function addStudent(parameter) {
  return axios({
    url: '/student/add',
    method: 'post',
    data: parameter
  })
}

export function getStudent(parameter) {
  return axios({
    url: '/student/info',
    method: 'get',
    params: parameter
  })
}

export function editStudent(parameter) {
  return axios({
    url: '/student/update',
    method: 'post',
    data: parameter
  })
}
export function delStudent(parameter) {
  return axios({
    url: '/student/delete',
    method: 'get',
    params: parameter
  })
}


// 教师接口
export function getTeacherList(parameter) {
  return axios({
    url: '/teacher/list',
    method: 'get',
    params: parameter
  })
}

export function addTeacher(parameter) {
  return axios({
    url: '/teacher/add',
    method: 'post',
    data: parameter
  })
}

export function getTeacher(parameter) {
  return axios({
    url: '/teacher/info',
    method: 'get',
    params: parameter
  })
}

export function editTeacher(parameter) {
  return axios({
    url: '/teacher/update',
    method: 'post',
    data: parameter
  })
}

export function delTeacher(parameter) {
  return axios({
    url: '/teacher/delete',
    method: 'get',
    params: parameter
  })
}

export function findTeacher(parameter) {
  return axios({
    url: '/teacher/easyList',
    method: 'get',
    params: parameter
  })
}
// 字典表接口

export function findSubject(parameter) {
  return axios({
    url: '/dictionary/findSubject',
    method: 'get',
    params: parameter
  })
}

export function findPosition(parameter) {
  return axios({
    url: '/dictionary/list',
    method: 'get',
    params: parameter
  })
}
// 年级接口
export function getGradeList(parameter) {
  return axios({
    url: '/grade/list',
    method: 'get',
    params: parameter
  })
}
// /grade/getSchoolTime
export function getSchoolTime(parameter) {
  return axios({
    url: '/grade/getSchoolTime',
    method: 'get',
    params: parameter
  })
}
export function updateSchoolTime(parameter) {
  return axios({
    url: '/grade/updateSchoolTime',
    method: 'post',
    data: parameter
  })
}

// 课表接口
export function getScheduleList(parameter) {
  return axios({
    url: "/schedule/info",
    method: 'get',
    params: parameter
  })
}
// role 接口
export function getRoleList(parameter) {
  return axios({
    // url: "/role/page",
    url: "/adminapi/index/rolepage",
    method: 'get',
    params: parameter
  })
}

export function getSubjectList(parameter) {
  return axios({
    url: api.Subject.list,
    method: 'get',
    params: parameter
  })
}



export function getExperimentExamVideoList(parameter) {
  return axios({
    url: api.Experiment.Exam.Video.list,
    method: 'get',
    params: parameter
  })
}

export function getExperimentExamList(parameter) {
  return axios({
    url: api.Experiment.Exam.list,
    method: 'get',
    params: parameter
  })
}


export function getPermissions(parameter) {
  return axios({
    url: api.permissionNoPager,
    method: 'get',
    params: parameter
  })
}

export function getOrgTree(parameter) {
  return axios({
    url: api.orgTree,
    method: 'get',
    params: parameter
  })
}

// id == 0 add     post
// id != 0 update  put
export function saveService(parameter) {
  return axios({
    url: api.service,
    method: parameter.id == 0 ? 'post' : 'put',
    data: parameter
  })
}